import audittask from "assets/images/audit_task.png";
import frowstart from "../../assets/images/frow_start.png";
import frowend from "../../assets/images/frow_end.png";
import groupstart from "../../assets/images/group_start.png";
import groupend from "../../assets/images/group_end.png";

import usertask from "../../assets/images/person_frow.png";
import servicetask from "../../assets/images/service_task.png";
import scripttask from "../../assets/images/script_task.png";

import InclusiveGateway from "../../assets/images/gateway1.png";
import exclusiveGateway from "../../assets/images/gateway2.png";
import parallelGateway from "../../assets/images/gateway3.png";

/* 默认锚点 */
const anchor = [
  [0.5, 0], // 上面边的中点
  [0.5, 1], // 下边边的中点
  [0, 0.5], // 左边面边的中点
  [1, 0.5], // 右边的中点
];

const baseTaskStyle = {
  fill: "#fff",
  stroke: "#FFBB95",
};

const taskShapStyle = {
  UserTask: baseTaskStyle,
  AuditTask: baseTaskStyle,
  ServiceTask: baseTaskStyle,
  ScriptTask: baseTaskStyle,
  GroupTaskStart: { fill: "#fff", stroke: "#a5e181" },
  StartNoneEvent: { fill: "#fff", stroke: "#a5e181" },
  EndNoneEvent: { fill: "#fff", stroke: "#f10000" },
  GroupTaskEnd: { fill: "#fff", stroke: "#f10000" },
  InclusiveGateway: { fill: "#f0f4f7", stroke: "#f0f4f7" },
  ParallelGateway: { fill: "#f0f4f7", stroke: "#f0f4f7" },
  ExclusiveGateway: { fill: "#f0f4f7", stroke: "#f0f4f7" },
};

/* 任务 配置 */
const taskArr = [
  {
    shape: "UserTask",
    activeShape: "UserActive",
    label: "用户任务",
    color_type: "#FFBB95",
    type_icon_url: usertask,
  },
  {
    shape: "AuditTask",
    activeShape: "UserActive",
    label: "审批任务",
    color_type: "#FFBB95",
    type_icon_url: audittask,
  },
  {
    shape: "ServiceTask",
    activeShape: "ServiceActive",
    label: "服务任务",
    color_type: "#FFBB95",
    type_icon_url: servicetask,
  },
  {
    shape: "ScriptTask",
    activeShape: "ScriptActive",
    label: "脚本任务",
    color_type: "#FFBB95",
    type_icon_url: scripttask,
  },
];

/* 事件 配置 */
const eventArr = [
  {
    shape: "StartNoneEvent",
    label: "开始",
    color_type: "#fff",
    type_icon_url: frowstart,
    anchor: [
      [
        0.5,
        0,
        {
          type: "output",
        },
      ],
      [
        0.5,
        1,
        {
          type: "output",
        },
      ],
      [
        0,
        0.5,
        {
          type: "output",
        },
      ],
      [
        1,
        0.5,
        {
          type: "output",
        },
      ],
    ],
  },
  {
    shape: "EndNoneEvent",
    label: "结束",
    color_type: "#fff",
    type_icon_url: frowend,
    anchor: [
      [
        0.5,
        0,
        {
          type: "input",
        },
      ],
      [
        0.5,
        1,
        {
          type: "input",
        },
      ],
      [
        0,
        0.5,
        {
          type: "input",
        },
      ],
      [
        1,
        0.5,
        {
          type: "input",
        },
      ],
    ],
  },



  {
    shape: "GroupTaskStart",
    label: "开始",
    color_type: "#fff",
    type_icon_url: groupstart,

  },
  {
    shape: "GroupTaskEnd",
    label: "结束",
    color_type: "#fff",
    type_icon_url: groupend,

  },
];

/* 网关 配置 */
const gatewayArr = [
  {
    shape: "InclusiveGateway",
    label: "包含",
    color_type: "#f0f4f7",
    type_icon_url: InclusiveGateway,
    show_condition: true,
  },
  {
    shape: "ParallelGateway",
    label: "并行",
    color_type: "#f0f4f7",
    type_icon_url: parallelGateway,
    show_condition: false,
  },
  {
    shape: "ExclusiveGateway",
    label: "排他",
    color_type: "#f0f4f7",
    type_icon_url: exclusiveGateway,
    show_condition: true,
  },
];

/* 左侧菜单 配置 */
const itempannelMenu = [
  {
    key: "sub1",
    label: "事件",
    children: [
      {
        key: "1",
        datashape: "StartNoneEvent",
        datatype: "node",
        datasize: "32*32",
        datacolor: "#a5e181",
        label: "开始",
        prefixType: "Zcon",
        prefixValue: "circle-o",
      },
      {
        key: "2",
        datashape: "EndNoneEvent",
        datatype: "node",
        datasize: "32*32",
        datacolor: "#fbeeee",
        label: "结束",
        prefixType: "Zcon",
        prefixValue: "pitch-on",
      },
    ],
  },
  {
    key: "sub2",
    label: "活动",
    children: [
      {
        key: "1",
        datashape: "UserTask",
        datatype: "node",
        datasize: "120*60",
        label: "用户任务",
        datacolor: "#FFBB95",
        prefixType: "Zcon",
        prefixValue: "human",
      },
      // {
      //   key: "2",
      //   datashape: "AuditTask",
      //   datatype: "node",
      //   datasize: "120*60",
      //   label: "审批任务",
      //   datacolor: "#a5e181",
      //   prefixType: "Zcon",
      //   prefixValue: "approval",
      // },
      {
        key: '2',
        datashape: 'ServiceTask',
        datatype: 'node',
        datasize: '120*60',
        datacolor: '#FFBB95',
        label: '服务任务',
        prefixType: 'Zcon',
        prefixValue: 'iot',
      },
      {
        key: '3',
        datashape: 'ScriptTask',
        datatype: 'node',
        datasize: '120*60',
        datacolor: '#FFBB95',
        label: '脚本任务',
        prefixType: 'Zcon',
        prefixValue: 'feedback-rec',
      },
      {
        key: '4',
        datashape: 'GroupTask',
        datatype: 'node',
        datasize: '188*46',
        datacolor: '#FFBB95',
        label: '子流程',
        prefixType: 'Zcon',
        prefixValue: 'feedback-rec',

      },

    ],
  },
  {
    key: "sub4",
    label: "网关",
    children: [
      {
        key: "1",
        datashape: "InclusiveGateway",
        datatype: "node",
        datasize: "38*38",
        datacolor: "#f0f4f7",
        label: "包含",
        prefixType: "Zcon",
        prefixValue: "contain",
      },
      {
        key: "2",
        datashape: "ParallelGateway",
        datatype: "node",
        datasize: "38*38",
        datacolor: "#f0f4f7",
        label: "并行",
        prefixType: "Zcon",
        prefixValue: "parallel",
      },
      {
        key: "3",
        datashape: "ExclusiveGateway",
        datatype: "node",
        datasize: "38*38",
        datacolor: "#f0f4f7",
        label: "排他",
        prefixType: "Zcon",
        prefixValue: "exclusive",
      },
    ],
  },
];

export {
  taskShapStyle,
  baseTaskStyle,
  anchor,
  taskArr,
  eventArr,
  gatewayArr,
  itempannelMenu,
};
